
<select name ="destination_tree_id" id="destination_tree_id" class="search_form_home_select_long" > 
    <option value="">-- Choice a Destination --</option>        
</select>   

   <script type="text/javascript">
		$(function(){                          
			$('#destination_tree_master_id_holidays').change(function(){
                               getDestinationsChild($(this).val());
                        })
                })

          
          $(document).ready(function(){	 
               getDestinationsChild($('#destination_tree_master_id_holidays').val());
          });
          

          function getDestinationsChild(id){
              if (id){
                   <?php 
                       $url = (strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === false) ? 'http' : 'https';
                       $host = $_SERVER['HTTP_HOST'];  
                       $url  = $url . '://' . $host . "/get_destination_child.php";
                   ?>               
                  $.getJSON('<?php echo $url ?>', {parent_id: id, ajax: 'true'}, function(results){
                                var options;
                                
			 	for (var i = 0; i < results.length; i++) {
				       options += '<option value="' + results[i].tree_id +' " ' + selected(results[i].tree_id) +  '>' 
                                           + results[i].name + '</option>';
				}
                                if (! options)
                                        options = '<option value="">-- Choice a destination --</option>';	
			        $('#destination_tree_id').html(options).show();
				$('.loading').hide();
 			});        
               } else {
                    $('#destination_tree_id').html('<option value="">– Choice a destination –</option>');
             }
          }
          
          function selected (value){
              var valueSelected = 
                  <?php 
                           if($holiday_search_form_values['destination_tree_id'])
                               echo $holiday_search_form_values['destination_tree_id'];
                           else echo "''";
                  ?>;
              if (value == valueSelected)  {
                  return 'selected="selected" ';
              } else return '';
          }
   </script>
   